package com.example.test;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;

public class Demo02 {

    public static void main(String[] args) throws ParseException {
        Thread thread=new Thread(()->{});
        if (!thread.isAlive()){
            thread.start();
        }

        try {
            if (thread.isAlive()){
                thread.join();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        if (!thread.isAlive()){
            Thread.State state = thread.getState();
            System.out.println(state);
        }

    }

    private static List<String> getList() {
        return null;
    }

    private static void test01() throws ParseException {
        Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.000'Z'").parse("2021-08-19T07:00:00.000Z");
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd HH:mm");
        String format = simpleDateFormat.format(date);
        System.out.println(format);

        LocalDateTime parse = LocalDateTime.parse("2021-08-19T07:00:00.000Z", DateTimeFormatter.ISO_OFFSET_DATE_TIME);
        LocalDateTime localDateTime = parse.plusHours(1L);
        DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("yyyyMMdd HH:mm");
        DateTimeFormatter dtf3 = DateTimeFormatter.ofPattern("HH:mm");
        System.out.println(dtf2.format(parse));
        System.out.println(dtf3.format(localDateTime));

        System.out.println(new BigDecimal(Math.random()/1000).setScale(4, RoundingMode.FLOOR));
    }
}
